from flask import Flask

"""
main flask demo
"""

app = Flask(__name__)
app.config.from_object("config")

@app.route("/book/search/<q>/<page>")
def search(q,page):
    """

    :param q: 普通关键字 isbn
    :param name:
    :return:
    """
    isbn_or_key = "q"
    if len(q) == 13 and q.isdigit():
        isbn_or_key = "isbn"

    short_q = q.replace("-","")
    if "-" in q and len(short_q) == 10 and short_q.isdigit:
        isbn_or_key = "isbn"

    return isbn_or_key

if __name__ == "__main__":
    app.run(port=8001,debug=app.config.get("DEBUG"))

